package com.bosssoft.hr.jobmonitor.config.common;

import com.bosssoft.hr.jobmonitor.core.file.FileTool;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.ResourceLoader;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/***
 * @Author lys(cherish)
 * @Description  系统通用配置
 * @Date  2019/2/26
 **/
@Configuration
public class CommonConfig {

    /***
     * @Author lys(cherish)
     * @Description 获取资源对象
     * @Date  2019/2/26
     * @Param []
     * @return org.springframework.core.io.ResourceLoader
     **/
    public ResourceLoader resourceLoader() {
        return new DefaultResourceLoader();
    }

    /***
     * @Author lys(cherish)
     * @Description 文件读取工具对象交给spring管理
     * @Date  2019/2/26
     * @Param []
     * @return com.bosssoft.hr.jobmonitor.core.file.FileTool
     **/
    @Bean
    public FileTool readFileTool(){
        return new FileTool();
    }

    /***
     * @Author lys(cherish)
     * @Description 线程池任务定时器对象交给spring管理
     * @Date  2019/2/26
     * @Param []
     * @return org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler
     **/
    @Bean
    public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
        return new ThreadPoolTaskScheduler();
    }



}
